Change in openvpn[master]: forward: Avoid conversion warning in ipv6_send_icmp_unreachable
A message that is not in the archive (sent off-list or not yet received): gerrit.1768323591000.I701f9e0a96a7b43f278f8e6089e9156feab772c8@...2715...
Attention is currently required from: plaisthos.
Hello plaisthos,
I'd like you to do a code review.
Please visit
http://gerrit.openvpn.net/c/openvpn/+/1472?usp=email
to review the following change.
Change subject: forward: Avoid conversion warning in ipv6_send_icmp_unreachable
......................................................................
forward: Avoid conversion warning in ipv6_send_icmp_unreachable
Since all values are limited by MAX_ICMPV6LEN we can just cast to uint16_t.
While here remove a unused gc arena in neighbouring code.
---
M src/openvpn/forward.c
1 file changed, 5 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1472/1
src/openvpn/forward.c +5 -16
@@ -1352,11 +1352,6 @@check_status (c->c2.buf.len,"read from TUN/TAP" ,NULL , c->c1.tuntap); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif -/** * Drops UDP packets which OS decided to route via tun. *
@@ -1483,8 +1478,6 @@void process_incoming_tun (struct context *c,struct link_socket *out_sock) { -struct gc_arena gc =gc_new (); -if (c->c2.buf.len >0 ) { c->c2.tun_read_bytes += c->c2.buf.len;
@@ -1528,7 +1521,6 @@ {buf_reset (&c->c2.to_link); } -gc_free (&gc); }/**
@@ -1593,7 +1585,7 @@ icmp6out.icmp6_type =OPENVPN_ICMP6_DESTINATION_UNREACHABLE ; icmp6out.icmp6_code =OPENVPN_ICMP6_DU_NOROUTE ; -int icmpheader_len =sizeof (struct openvpn_ipv6hdr ) +sizeof (struct openvpn_icmp6hdr ); +const int icmpheader_len =sizeof (struct openvpn_ipv6hdr ) +sizeof (struct openvpn_icmp6hdr );int totalheader_len = icmpheader_len;if (TUNNEL_TYPE (c->c1.tuntap) ==DEV_TYPE_TAP )
@@ -1606,10 +1598,11 @@* frame should be <= 1280 and have as much as possible of the original * packet */ -int max_payload_size =min_int (MAX_ICMPV6LEN , c->c2.frame.tun_mtu - icmpheader_len); -int payload_len =min_int (max_payload_size,BLEN (&inputipbuf)); +const int max_payload_size =min_int (MAX_ICMPV6LEN , c->c2.frame.tun_mtu - icmpheader_len); +const int payload_len =min_int (max_payload_size,BLEN (&inputipbuf)); +const uint16_t icmp_len = (uint16_t )(sizeof (struct openvpn_icmp6hdr ) + payload_len); - pip6out.payload_len =htons (sizeof (struct openvpn_icmp6hdr ) + payload_len); + pip6out.payload_len =htons (icmp_len);/* Construct the packet as outgoing packet back to the client */ struct buffer *outbuf;
@@ -1665,10 +1658,6 @@#undef MAX_ICMPV6LEN } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -void process_ip_header (struct context *c,unsigned int flags,struct buffer *buf,struct link_socket *sock)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1472?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I701f9e0a96a7b43f278f8e6089e9156feab772c8
Gerrit-Change-Number: 1472
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Attention is currently required from: flichtenheld, plaisthos.
cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1472?usp=email )
Change subject: forward: Avoid conversion warning in ipv6_send_icmp_unreachable
......................................................................
Patch Set 1: Code-Review+2
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1472?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I701f9e0a96a7b43f278f8e6089e9156feab772c8
Gerrit-Change-Number: 1472
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Thu, 15 Jan 2026 09:11:06 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
PATCH 1/1 forward: Avoid conversion warning in ipv6_send_icmp_unreachable
In reply to a message not in the archiveFrom: Frank Lichtenheld <[email protected]...>
Since all values are limited by MAX_ICMPV6LEN we can just cast to uint16_t.
While here remove a unused gc arena in neighbouring code.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1472
---
This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1472
This mail reflects revision 1 of this Change.
Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>
src/openvpn/forward.c +5 -16
@@ -1352,11 +1352,6 @@check_status (c->c2.buf.len,"read from TUN/TAP" ,NULL , c->c1.tuntap); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif -/** * Drops UDP packets which OS decided to route via tun. *
@@ -1483,8 +1478,6 @@void process_incoming_tun (struct context *c,struct link_socket *out_sock) { -struct gc_arena gc =gc_new (); -if (c->c2.buf.len >0 ) { c->c2.tun_read_bytes += c->c2.buf.len;
@@ -1528,7 +1521,6 @@ {buf_reset (&c->c2.to_link); } -gc_free (&gc); }/**
@@ -1593,7 +1585,7 @@ icmp6out.icmp6_type =OPENVPN_ICMP6_DESTINATION_UNREACHABLE ; icmp6out.icmp6_code =OPENVPN_ICMP6_DU_NOROUTE ; -int icmpheader_len =sizeof (struct openvpn_ipv6hdr ) +sizeof (struct openvpn_icmp6hdr ); +const int icmpheader_len =sizeof (struct openvpn_ipv6hdr ) +sizeof (struct openvpn_icmp6hdr );int totalheader_len = icmpheader_len;if (TUNNEL_TYPE (c->c1.tuntap) ==DEV_TYPE_TAP )
@@ -1606,10 +1598,11 @@* frame should be <= 1280 and have as much as possible of the original * packet */ -int max_payload_size =min_int (MAX_ICMPV6LEN , c->c2.frame.tun_mtu - icmpheader_len); -int payload_len =min_int (max_payload_size,BLEN (&inputipbuf)); +const int max_payload_size =min_int (MAX_ICMPV6LEN , c->c2.frame.tun_mtu - icmpheader_len); +const int payload_len =min_int (max_payload_size,BLEN (&inputipbuf)); +const uint16_t icmp_len = (uint16_t )(sizeof (struct openvpn_icmp6hdr ) + payload_len); - pip6out.payload_len =htons (sizeof (struct openvpn_icmp6hdr ) + payload_len); + pip6out.payload_len =htons (icmp_len);/* Construct the packet as outgoing packet back to the client */ struct buffer *outbuf;
@@ -1665,10 +1658,6 @@#undef MAX_ICMPV6LEN } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -void process_ip_header (struct context *c,unsigned int flags,struct buffer *buf,struct link_socket *sock)
[Openvpn-devel] [PATCH applied] Re: forward: Avoid conversion warning in ipv6_send_icmp_unreachable
And here comes the last one for today... straightforward enough, mostly adding a few "const" and untangling the ntohs(sum) call into two lines. Plus ripping out a dead gc_arena.
Your patch has been applied to the master branch.
commit 8c3671dbd538f89159a258acf0306999abf7ecb0
Author: Frank Lichtenheld Date: Thu Jan 15 10:11:16 2026 +0100
forward: Avoid conversion warning in ipv6_send_icmp_unreachable
Signed-off-by: Frank Lichtenheld <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1472
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59283657/
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering
cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1472?usp=email )
The following approvals got outdated and were removed:
Code-Review+2 by cron2
Change subject: forward: Avoid conversion warning in ipv6_send_icmp_unreachable
......................................................................
forward: Avoid conversion warning in ipv6_send_icmp_unreachable
Since all values are limited by MAX_ICMPV6LEN we can just cast to uint16_t.
While here remove a unused gc arena in neighbouring code.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1472
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59283657/
---
M src/openvpn/forward.c
1 file changed, 5 insertions(+), 16 deletions(-)
git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/72/1472/2
src/openvpn/forward.c +5 -16
@@ -1352,11 +1352,6 @@check_status (c->c2.buf.len,"read from TUN/TAP" ,NULL , c->c1.tuntap); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif -/** * Drops UDP packets which OS decided to route via tun. *
@@ -1483,8 +1478,6 @@void process_incoming_tun (struct context *c,struct link_socket *out_sock) { -struct gc_arena gc =gc_new (); -if (c->c2.buf.len >0 ) { c->c2.tun_read_bytes += c->c2.buf.len;
@@ -1528,7 +1521,6 @@ {buf_reset (&c->c2.to_link); } -gc_free (&gc); }/**
@@ -1593,7 +1585,7 @@ icmp6out.icmp6_type =OPENVPN_ICMP6_DESTINATION_UNREACHABLE ; icmp6out.icmp6_code =OPENVPN_ICMP6_DU_NOROUTE ; -int icmpheader_len =sizeof (struct openvpn_ipv6hdr ) +sizeof (struct openvpn_icmp6hdr ); +const int icmpheader_len =sizeof (struct openvpn_ipv6hdr ) +sizeof (struct openvpn_icmp6hdr );int totalheader_len = icmpheader_len;if (TUNNEL_TYPE (c->c1.tuntap) ==DEV_TYPE_TAP )
@@ -1606,10 +1598,11 @@* frame should be <= 1280 and have as much as possible of the original * packet */ -int max_payload_size =min_int (MAX_ICMPV6LEN , c->c2.frame.tun_mtu - icmpheader_len); -int payload_len =min_int (max_payload_size,BLEN (&inputipbuf)); +const int max_payload_size =min_int (MAX_ICMPV6LEN , c->c2.frame.tun_mtu - icmpheader_len); +const int payload_len =min_int (max_payload_size,BLEN (&inputipbuf)); +const uint16_t icmp_len = (uint16_t )(sizeof (struct openvpn_icmp6hdr ) + payload_len); - pip6out.payload_len =htons (sizeof (struct openvpn_icmp6hdr ) + payload_len); + pip6out.payload_len =htons (icmp_len);/* Construct the packet as outgoing packet back to the client */ struct buffer *outbuf;
@@ -1665,10 +1658,6 @@#undef MAX_ICMPV6LEN } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -void process_ip_header (struct context *c,unsigned int flags,struct buffer *buf,struct link_socket *sock)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1472?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I701f9e0a96a7b43f278f8e6089e9156feab772c8
Gerrit-Change-Number: 1472
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1472?usp=email )
Change subject: forward: Avoid conversion warning in ipv6_send_icmp_unreachable
......................................................................
forward: Avoid conversion warning in ipv6_send_icmp_unreachable
Since all values are limited by MAX_ICMPV6LEN we can just cast to uint16_t.
While here remove a unused gc arena in neighbouring code.
Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1472
Message-Id: <[email protected]...>
URL: https://sourceforge.net/p/openvpn/mailman/message/59283657/
---
M src/openvpn/forward.c
1 file changed, 5 insertions(+), 16 deletions(-)
src/openvpn/forward.c +5 -16
@@ -1352,11 +1352,6 @@check_status (c->c2.buf.len,"read from TUN/TAP" ,NULL , c->c1.tuntap); } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wconversion" -#endif -/** * Drops UDP packets which OS decided to route via tun. *
@@ -1483,8 +1478,6 @@void process_incoming_tun (struct context *c,struct link_socket *out_sock) { -struct gc_arena gc =gc_new (); -if (c->c2.buf.len >0 ) { c->c2.tun_read_bytes += c->c2.buf.len;
@@ -1528,7 +1521,6 @@ {buf_reset (&c->c2.to_link); } -gc_free (&gc); }/**
@@ -1593,7 +1585,7 @@ icmp6out.icmp6_type =OPENVPN_ICMP6_DESTINATION_UNREACHABLE ; icmp6out.icmp6_code =OPENVPN_ICMP6_DU_NOROUTE ; -int icmpheader_len =sizeof (struct openvpn_ipv6hdr ) +sizeof (struct openvpn_icmp6hdr ); +const int icmpheader_len =sizeof (struct openvpn_ipv6hdr ) +sizeof (struct openvpn_icmp6hdr );int totalheader_len = icmpheader_len;if (TUNNEL_TYPE (c->c1.tuntap) ==DEV_TYPE_TAP )
@@ -1606,10 +1598,11 @@* frame should be <= 1280 and have as much as possible of the original * packet */ -int max_payload_size =min_int (MAX_ICMPV6LEN , c->c2.frame.tun_mtu - icmpheader_len); -int payload_len =min_int (max_payload_size,BLEN (&inputipbuf)); +const int max_payload_size =min_int (MAX_ICMPV6LEN , c->c2.frame.tun_mtu - icmpheader_len); +const int payload_len =min_int (max_payload_size,BLEN (&inputipbuf)); +const uint16_t icmp_len = (uint16_t )(sizeof (struct openvpn_icmp6hdr ) + payload_len); - pip6out.payload_len =htons (sizeof (struct openvpn_icmp6hdr ) + payload_len); + pip6out.payload_len =htons (icmp_len);/* Construct the packet as outgoing packet back to the client */ struct buffer *outbuf;
@@ -1665,10 +1658,6 @@#undef MAX_ICMPV6LEN } -#if defined(__GNUC__) || defined(__clang__) -#pragma GCC diagnostic pop -#endif -void process_ip_header (struct context *c,unsigned int flags,struct buffer *buf,struct link_socket *sock)
--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1472?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email
Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I701f9e0a96a7b43f278f8e6089e9156feab772c8
Gerrit-Change-Number: 1472
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>